package com.wc.alorithm_blue_bridge._思维.年号字串;

/**
 * @Author congge
 * @Date 2023/10/12 20:35
 * @description https://www.lanqiao.cn/problems/605/learning/?page=2&first_category_id=1&sort=students_count&second_category_id=3
 */
public class Main {
    public static void main(String[] args) {
        int n = 2019;

        char[] map = new char[27];

        for (int i = 'A'; i <= 'Z'; i++) {
            map[i - 'A' + 1] = (char) i;
        }
        map[0] = 'Z';
//        System.out.println(Arrays.toString(map));
        StringBuffer ans = new StringBuffer();

        while (n != 0) {
            int remainder = n % 26;
            /**
             * 这里不是逢26进1
             * 而是有差别的，
             * 26的时候就是Z
             */
            if (remainder != 0) {
                ans.insert(0, map[remainder]);
                n -= remainder;
            } else {
                ans.insert(0, 'Z');
                n -= 26;
            }


            n /= 26;
        }
        System.out.println(ans);
    }
}
